<script type="text/javascript">
function auto_search(url_search)
{
    var key_search = $("#key_search").val();
    $.ajax({
        type: "POST",
        url: "<?php echo base_url()?>"+url_search,
        data: {key_search:key_search,field_search:$("#field_search").val(),type:"ajax"},
        cache: false,
        dataType: "html",
        success: function(data){
            $("#tbl_file_search").html(data);
        }
    });
}
function insert(file)
{
  $("#<?php echo $this->uri->segment(3)?>", top.document).val(file);
  parent.$.fn.colorbox.close();
}

</script>
<?php $seg2 = $this->uri->segment(2); ?>

<div class="media-upload-header">
    <ul id="menu">
        <li><a href="<?php echo base_url()?>file_manager/img_lib/<?php echo $this->uri->segment(3)?>" <?if($seg2=='img_lib'){echo ' class="current"';}?>><?php echo lang('file_mng_library');?></a></li>
        <li><a href="<?php echo base_url()?>file_manager/upload/<?php echo $this->uri->segment(3)?>" <?if($seg2=='upload'){echo ' class="current"';}?>><?php echo lang('file_mng_upload_file');?></a></li>
    </ul>
</div>
<div style="padding: 20px;height: 450px; overflow: auto;">
    <div style="text-align: center;width: 100%;" class="image_search_bar"><?php echo $search_bar;?></div>
    <div id="tbl_file_search">
        <br/>
        <table  class="site">
            <tr>
                <td><?php echo lang('file_mng_image');?></td>
                <td><?php echo lang('file_mng_title');?></td>
                <td><?php echo lang('file_mng_file_name');?></td>
                <td><?php echo lang('file_mng_choose_file');?></td>
                <td><?php echo lang('file_mng_description');?></td>
            </tr>
        <?
        foreach($list as $rs):
        //$img = explode('/',$rs->lb_url);
        ?>
            <tr>
                <td><a href="javascript:;" onclick="insert('<?php echo $rs->file_name?>');"><?php echo $this->icon_lib->loadtypefile($rs->dir_name.$rs->file_name,$rs->ext)?></a></td>
                <td><a href="javascript:;" onclick="insert('<?php echo $rs->file_name?>');"><?php echo $rs->title?></a></td>
                <td><a href="javascript:;" onclick="insert('<?php echo $rs->file_name?>');"><?php echo $rs->file_name?></a></td>
                <td style="width: 120px;font-weight: bold;"><a id="cboxClose" href="javascript:;" onclick="insert('<?php echo $rs->file_name?>');">Chọn</a></td>
                <td><a  href="javascript:;" onclick="insert('<?php echo $rs->file_name?>');"><?php echo $rs->description;?></a></td>
            </tr>
        <?php endforeach;?>
        </table>
        <div class="pages"><?php echo $pagination?></div>
    </div>

</div>